<!DOCTYPE html>
<html lang="zh-CN"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>发表评价</title>
    <meta charset="UTF-8">
    <title>发表评价</title>
    <meta name="keywords" content="发表评价"/>
    <meta name="description" content="发表评价"/>
    <meta name="viewport"
          content="width=device-width,initial-scale=1, maximum-scale=1,minimum-scale=1, user-scalable=no">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="format-detection" content="telephone=no"/>
    <meta name="viewport" content="width=device-width,viewport-fit=cover">
    <meta name="_csrf" th:content="${_csrf.token}"/>
    <meta name="_csrf_header"  th:content="${_csrf.headerName}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/shoppingApi/css/public.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/shoppingApi/css/publicOfuser.css}">
    <script type="text/javascript" th:src="@{/shoppingApi/js/jquery-3.3.1.min.js}"></script>
    <script type="application/javascript" th:src="@{/shoppingApi/js/common.js}"></script>
</head>
<body>

<div class="main bgfff">

    <div class="main_con c323232">

        <div style="vertical-align: middle;height: 56px;line-height: 56px;">
            <img th:src="@{/shoppingApi/images/avatar.png}" style="width: 38px;height: 38px;"
                 class="ml15">
            <input  type="hidden" class="userId" name="userId" value="1005" >
            <input  type="hidden" class="guigeId" name="guigeId" value="1005" >
            <span class="ft15 ml10" style="vertical-align: middle;" th:text="${map.userId}">洋芋炒土豆</span>

        </div>

        <hr class="hr1">

        <textarea style="height: 150px;width: 100%; padding-top: 15px;padding-left: 15px;" class="ft15 c969696 content"
                  placeholder="说说您的使用心得"
                  type="text"></textarea>

        <hr class="hr1">

        <div class="ml10 mt15">
            <input type="checkbox" name="niMingSign" class="checkbox" checked="checked" value=""><label class="pl10">匿名</label>
            <span class="c969696 ft15 fr mr15">你的评价能帮助别的小伙伴哟</span>
        </div>

        <hr class="hr1 mt15">

        <div class="fixed-bottom ftc fixedBox50" style="background-color: #f70029;line-height: 50px;">
            <p class="ft17 cfff bgf70029 fabu">发布</p>

        </div>
        <span class="fabu-msg" style="color: red;font-size: 6px"></span>
    </div>
</div>
</body>
<script type="application/javascript">
    /*请求头定义*/
    var header = $("meta[name='_csrf_header']").attr("content");
    var token =$("meta[name='_csrf']").attr("content");
   $('.fabu').on('click',function () {
       var userId=$('.userId').val();
       var content=$('.content').val();
       var guigeId=$('.guigeId').val();
       var niMingSign="";
       var a=$('.checkbox').prop("checked");
       if(a){
           niMingSign='1';
       }else{
           niMingSign='0';
       }
       if(userId!=""&&userId!=null&&guigeId!=""&&guigeId!=null&&content!=""&&content!=null){
       $.ajax({
           type:'post',
           url:'/wap/addProductComment',
           data:{
               'userId':userId,
                'content':content,
               'guigeId':guigeId,
               'niMingSign':niMingSign
           },
           success:function (result) {
               console.log(result);
               if(result.row=='1'){
                   $('.fabu-msg').html("发布成功！");
               }else{
                   $('.fabu-msg').html("发布失败！");
               }

           },
           beforeSend : function(xhr) {
               xhr.setRequestHeader(header, token);
           }
       })
       }else{
           $('.fabu-msg').html("内容不能为空！");
       }
   });
</script>


</html>